<template>
  <view :class="{'fixed':fixed}" class="save-button">
    <button :disabled="disabled" type="primary" @click="handleClick">{{ text }}</button>
  </view>
</template>

<script>
export default {
  props: {
    text: {
      type: String,
      default: () => "确定"
    },
    disabled: {
      type: Boolean,
      default: () => false
    },
    fixed: {
      type: Boolean,
      default: () => true
    }
  },
  methods: {
    handleClick() {
      this.$emit("click");
    }
  }
};
</script>

<style scoped lang="scss">
$padding: 20rpx;
.save-button {
  margin: $padding;
  &.fixed {
    position: fixed;
    bottom: $padding;
    left: $padding;
    right: $padding;
    z-index: 10;
  }
}
</style>
